﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SF.Base.Core;
using System.Text;

namespace SF.Dict.Web {
	public partial class Create : BasePage {
		protected void Page_Load(object sender, EventArgs e) {
			if (Global.DTUser == null) {
				Response.Redirect("/login.aspx?return=" + Server.UrlEncode("/create.aspx"));
			}

			UserEntity user = Global.DTUser;

			List<StationEntity> Stations = VocabularyRules.GetVocabularyStation();

			StringBuilder sb = new StringBuilder();
			sb.Append("<ul id='station'>");
			foreach(StationEntity s in Stations){
				if (user.UserMeta["station"] != null && s.Name == user.UserMeta["station"].ToLower()) {
					sb.AppendFormat("<li><div><input id='station_{0}' checked ='checked' type='radio' value='{0}' name='stations'></div><div><label for='station_{0}'>{1}</label></div></li>", s.SID, s.Name);
				}
				else {
					sb.AppendFormat("<li><div><input id='station_{0}' type='radio' value='{0}' name='stations'></div><div><label for='station_{0}'>{1}</label></div></li>", s.SID, s.Name);
				}
			}
			sb.Append("</ul>");

			ltl_station.Text = sb.ToString();
		}
	}
}